import re

url_demo = "https://e4ftl01.cr.usgs.gov//DP106/MOLT/MOD13Q1.006/2020.12.18/MOD13Q1.A2020353.h27v05.006.2021003224802.hdf"


with open("url2_250m.url.txt", 'r') as f:
    data = f.read().split("\n")


def group(file_name):
    m = file_name+"\."+"\d{2}" + "\."
    with open("./data_urls/" + file_name+".url", 'w') as uf:
        for i in data:
            if re.search(m, i):
                uf.write(i)
                uf.write("\n")

if __name__ == '__main__':
    # group("2020")
    for x in range(2000, 2021):
        group(str(x))